package com.asura.qqeffect.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Asura on 2016/12/9.
 */

public class Scroll4 extends ViewGroup {
    public Scroll4(Context context) {
        super(context);
    }

    public Scroll4(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public Scroll4(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.i("TAG", "ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.i("TAG", "ACTION_MOVE");
                return true;
        }
        return super.onInterceptTouchEvent(ev);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View view = getChildAt(i);
            view.layout(l, t, 100, 100);
        }
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
//        switch (ev.getAction()) {
//            case MotionEvent.ACTION_DOWN:
//                Log.i("TAG", "ACTION_DOWN");
//                break;
//            case MotionEvent.ACTION_MOVE:
//                Log.i("TAG", "ACTION_MOVE");
//                break;
//        }
        return super.dispatchTouchEvent(ev);
    }
}
